<%--
Created by IntelliJ IDEA.
User: wwh
Date: 2017/8/14
Time: 10:23
To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>学生实习评价</title>
    <script type="text/javascript" src="../../static/common/ckeditor/ckeditor.js"></script>
    <link rel="stylesheet" href="/static/common/layui/css/layui.css">
    <link rel="stylesheet" href="/static/css/global.css">
    <link rel="stylesheet" href="/static/css/table.css">
    <script type="text/javascript" src="../../static/common/jquery/jquery-1.11.1.min.js"></script>
    <script src="../../static/common/axios.min.js"></script>
</head>
<body>
<div>
    <form class="layui-form">
        <div class="layui-form-item">
            <label class="layui-form-label">学生姓名</label>
            <div class="layui-input-inline">
                <input class="layui-input" disabled>
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">实习评价</label>
            <div class="layui-input-block">
                <textarea id="ta_ckeditor" class="ckeditor my-math" cols="20" rows="3" style="overflow: auto;height: 700px;"></textarea>
                <script>CKEDITOR.replace('ta_ckeditor');</script>
            </div>
        </div>
        <div class="layui-form-item">
            <div class="layui-input-block">
                <button class="layui-btn" lay-filter="save" lay-submit>保存评价</button>
                <button class="layui-btn" onclick="history.go(-1)">返回</button>
            </div>
        </div>
    </form>
</div>
<script>
    var studentInfoUserid = <%=request.getParameter("studentInfoUserid")%>;
//    console.log(studentInfoUserid);
    var studentInfoDetail = {};
    var studentInfo = {};
    axios.get('/student/findDetail/'+studentInfoUserid)
        .then(function (response) {
//            console.log(response.data);
            studentInfoDetail = response.data.data;
            studentInfo = response.data.data.studentInfo;
            $('form input').val(studentInfoDetail.user.realname);
        })
        .catch(function (msg) {
            console.log(msg);
        })
</script>
<script src="../../static/common/vue.min.js"></script>
<script src="../../static/common/layui/layui.js"></script>
<script>
    layui.use(['form','jquery','layer'],function () {
        var form = layui.form(),
            $ = layui.jquery;
        form.on('submit(save)',function (data) {
            console.log(data);
            studentInfo.advisorappraise = CKEDITOR.instances.ta_ckeditor.getData();
            console.log(studentInfo);
            axios.post('/student/modifyOneById',studentInfo)
                .then(function (response) {
                    console.log(response.data);
                    if(response.data.success){
                        layer.msg('保存成功',{icon:1,time:1000},function () {
                            history.go(-1);
                        });
                    }
                })
                .catch(function (msg) {
                    console.log(msg);
                })
            return false;
        });
    });
</script>
</body>
</html>
